<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
    /**
     * @return void
     */
    protected function _initAutoload()
    {
        require_once('MyLib/acl/acl.php');
        require_once('MyLib/application/pojo.php');
        require_once('MyLib/component/controller.php');
        require_once('MyLib/component/controller-admin.php');
        require_once('MyLib/database/dbadapter.php');
        require_once('MyLib/image/image-db.php');
        require_once('MyLib/log/log.php');
        require_once('MyLib/order-service/order-service.php');
        require_once('MyLib/session/session.php');
        require_once('MyLib/shopping-cart/product-item.php');
        require_once('MyLib/shopping-cart/shopping-cart.php');
        require_once('MyLib/user/authentication.php');
        require_once('MyLib/user/user.php');
        require_once('MyLib/config.php');
        require_once('MyLib/factory.php');
    }

    /**
     * @return void
     */
    protected function _initConfig()
    {
        Zend_Paginator::setDefaultItemCountPerPage(PaginatorConfig::$ItemCountPerPage);
        Zend_Paginator::setDefaultPageRange(PaginatorConfig::$PageRange);
    }

    /**
     * @return void
     */
    protected function _initMail()
    {
        $mailTransport = new Zend_Mail_Transport_Smtp(
            'smtp.gmail.com',
            array(
                'auth' => 'login',
                'username' => 'classicodeal@gmail.com',
                'password' => 'ngocanhhung',
                'ssl' => 'tls',
                'port' => 587
            )
        );
        Zend_Mail::setDefaultTransport($mailTransport);
        Zend_Mail::setDefaultFrom('classicodeal@gmail.com', 'Classico Deal');
    }

    /**
     * @return void
     */
    protected function _initPlugin()
    {
        require_once(APPLICATION_PATH . '/plugins/AuthPlugin.php');
        require_once(APPLICATION_PATH . '/plugins/LayoutPlugin.php');
        $front = Zend_Controller_Front::getInstance();
        $front->registerPlugin(new AuthPlugin());
        $front->registerPlugin(new LayoutPlugin());
    }
}

